package com.wn.session;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

/**
 * @author yellow Docter
 * @date 2024 -06-21
 * @desc
 */
@WebServlet("/get")
public class Session02Servlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        //获取session
        HttpSession session = req.getSession();
        String id = session.getId();
        System.out.println("Session02Servlet id = " + id);

        //设置数据 就是操作 一个map的过程
        Object msg = session.getAttribute("msg");
        System.out.println("msg = " + msg);

    }
}
